<!--公共头部-->
{template 'aitimt/common/header'}
<style>
	.mui-preview-image.mui-fullscreen {position: fixed;z-index: 20;background-color: #000;}
	.mui-preview-header, .mui-preview-footer {position: absolute;width: 100%;left: 0;z-index: 10;}
	.mui-preview-header {height: 44px;top: 0;}  .mui-preview-footer {height: 50px;bottom: 0px;}
	.mui-preview-header .mui-preview-indicator {display: block;line-height: 25px;color: #fff;text-align: center;margin: 15px auto 4px;width: 70px;background-color: rgba(0, 0, 0, 0.4);border-radius: 12px;font-size: 16px;}
	.mui-preview-image {display: none;-webkit-animation-duration: 0.5s;animation-duration: 0.5s;-webkit-animation-fill-mode: both;animation-fill-mode: both;}
	.mui-preview-image.mui-preview-in {-webkit-animation-name: fadeIn;animation-name: fadeIn;}
	.mui-preview-image.mui-preview-out {background: none;-webkit-animation-name: fadeOut;animation-name: fadeOut;}
	.mui-preview-image.mui-preview-out .mui-preview-header, .mui-preview-image.mui-preview-out .mui-preview-footer {display: none;}
	.mui-zoom-scroller {position: absolute;display: -webkit-box;display: -webkit-flex;display: flex;-webkit-box-align: center;-webkit-align-items: center;align-items: center;-webkit-box-pack: center;-webkit-justify-content: center;justify-content: center;left: 0;right: 0;bottom: 0;top: 0;width: 100%;height: 100%;margin: 0;-webkit-backface-visibility: hidden;}
	.mui-zoom {-webkit-transform-style: preserve-3d;transform-style: preserve-3d;}
	.mui-slider .mui-slider-group .mui-slider-item img {width: auto;height: auto;max-width: 100%;max-height: 20rem;}
	.mui-android-4-1 .mui-slider .mui-slider-group .mui-slider-item img {width: 100%;}
	.mui-android-4-1 .mui-slider.mui-preview-image .mui-slider-group .mui-slider-item {display: inline-table;}
	.mui-android-4-1 .mui-slider.mui-preview-image .mui-zoom-scroller img {display: table-cell;vertical-align: middle;}
	.mui-preview-loading {position: absolute;width: 100%;height: 100%;top: 0;left: 0;display: none;}
	.mui-preview-loading.mui-active {display: block;}
	.mui-preview-loading .mui-spinner-white {position: absolute;top: 50%;left: 50%;margin-left: -25px;margin-top: -25px;height: 50px;width: 50px;}
	.mui-preview-image img.mui-transitioning {-webkit-transition: -webkit-transform 0.5s ease, opacity 0.5s ease;transition: transform 0.5s ease, opacity 0.5s ease;}
	@-webkit-keyframes fadeIn { 0% {opacity: 0;} 100% {opacity: 1;} }
	@keyframes fadeIn { 0% {opacity: 0;} 100% {opacity: 1;} }
	@-webkit-keyframes fadeOut { 0% {opacity: 1;} 100% {opacity: 0;} }
	@keyframes fadeOut { 0% {opacity: 1;} 100% {opacity: 0;} }
	.mui-table-view .mui-media, .mui-table-view .mui-media-body{line-height: 2rem;}
	.mui-slider-indicator.mui-segmented-control .mui-control-item {border-left:1px solid #c1c1c1 ;border-bottom:1px solid #c1c1c1 ;padding: 1px;color: #585858;}
	.mui-slider .mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active{border-bottom:3px solid #e94709 ;color: #585858;}
	.addtime{padding-top: 10px;font-size: 10px;}
	.mui-table-view .mui-media-object.mui-pull-left{margin-right: 25px;}
	.mui-content>.mui-table-view:first-child{margin: 0;}
	.mui-content ul{height: 6.5rem;}
	.entry-pro {font-weight: 500;font-size: 15px;color: #000000;background-color: #FFFFFF;padding: 10px 0 1px 5%;}
	.entry-message{position: absolute;width: 100%;height: 80%;font-weight: 500;font-size: 15px;color: #000000;background-color: #FFFFFF;padding: 10px 5% 1px 5%;}
	.entry-message input{height: 36px;border-radius: 8px;font-size: 15px;}
	.entry-message p{margin-top: 3%;margin-bottom: 1px;}
	.entry-message input::-webkit-input-placeholder{font-size:14px;color: #bcbcbc;}
	.entry-select{position: absolute;width: 95%;height: 4%;border: 1px solid #bcbcbc;margin-bottom: 10px;}
	.mui-btn-block{font-size: 14px;margin: 0;padding: 0;padding-left: 4%;line-height: 25px;color: #000000;}
	.mui-btn-block option:first-child{font-size: 14px;margin: 0;padding: 0;color: #bcbcbc;}
	.circle{width: 13px;height: 13px;margin-top: 3px;background-color: #595757;border-radius: 50%;display: inline-block;margin-right: 22px;float: right;text-align: center;line-height: 5px;color: #595757;letter-spacing: 0;}
	.circle-active{background-color: #e94709;color: #e94709;}
	.mui-content ul{height: 10rem;}
	.entry-message .phone-code{float: right;margin-right: 5%;background-color:#e94709 ;color: #FFFFFF;border-radius: 4px;font-size: 10px;width: 23%;text-align: center;}
	.id-card{position: absolute;width: 95%;height: 6rem;overflow: hidden;}
	.id-card .positive{position: absolute;left: 0;width: 45%;height: 100%;border: 1px solid #bcbcbc;}
	.id-card .reverse{position: absolute;right: 0;width: 45%;height: 100%;border: 1px solid #bcbcbc;margin-right: 5%;}
	.id-card img{position: absolute;top: 0;width: 45%;z-index: 10;margin: 10% 30%;}
	#reverse{position: absolute;height: 5rem;width: 10rem;top: 0;z-index: 20;opacity: 0;}
	#positive{position: absolute;height: 5rem;width: 10rem;top: 0;z-index: 20;opacity: 0;}
	#positive-img{margin:0;z-index: 15;width: 100%;height: 100%;}
	#reverse-img{margin:0;z-index: 15;width: 100%;height: 100%;}
	.mui-btn {display: block;width: 120px;margin: 10px auto;}
	.preview ul {margin: 0;padding: 0;}
	.preview ul li {position: relative;display: inline-block;margin-top: 10px;margin-bottom: 10px;margin-right: 10px;float: left;list-style: none;}
	.preview ul li img {width: 60px;height: 60px;border-radius: 5px;}
	.preview ul li input {display: inline-block;position: absolute;width: 50px;height: 50px;left: 0;top: 15px;opacity: 0;}
	.del {display: inline-block;position: absolute;top:6px;right: 0px;width: 12px;height: 2px;background: #ED544D;line-height: 0;font-size: 0;vertical-align: middle;-webkit-transform: rotate(45deg);}
	.del:after {content: "/";display: block;width: 12px;height: 2px;background: #ED544D;-webkit-transform: rotate(-90deg);}
	.recruit-wait{padding: 20%;font-size: 20px;color: #4e4e4e;background-color: #ffffff;}
	.mess{width: 100%;background: #ffffff;padding: 2% 5%;margin: 0;border-bottom: 1px solid #eeeeee;}
	.my-data{float: right;margin-right: 10%;}
	.buttomEdit{text-align: center;padding: 10px 46%;font-size: 15px;color: white;background: #ff6f02;}
</style>
<!-- 公共头部start -->
<header class="mui-bar mui-bar-nav">
	<a class="top-return mui-action-back"><img src="{$aideUrl}app/resource/aitimt/images/return.png" ></a>
	<a class="top-logo"><img src="{$aideUrl}app/resource/aitimt/images/logo.png" ></a>
	<!--公共菜单start -->
	{template 'aitimt/common/menu'}
	<!-- 公共菜单end-->
</header>
<!-- 公共头部end -->

{if $_GPC['edit']!=1}
<!--是否编辑状态-->
{if $recruit['is_confirm']==1&&$recruit['is_pass']==0}
<!--提交未审核-->

<div class="mui-content">
	<div class="recruit-wait">
		您的资料已经提交，请耐心等候审核结果通知
	</div>
</div>
{elseif $recruit['is_confirm']==1&&$recruit['is_pass']==1}
<!--//审核通过-->
<div class="mui-content">

	<p class="mess" style="margin-top: 10px;">昵称<span class="my-data">{if $recruit['nickname']}{$recruit['nickname']}{else}未填写{/if}</span></p>
	<p class="mess">姓名<span class="my-data">{if $recruit['name']}{$recruit['name']}{else}未填写{/if}</span></p>
	<p class="mess">手机<span class="my-data">{if $recruit['mobile']}{$recruit['mobile']}{else}未填写{/if}</span></p>
	<p class="mess">电子邮箱<span class="my-data">{if $recruit['email']}{$recruit['email']}{else}未填写{/if}</span></p>
	<p class="mess">常住城市<span class="my-data">{if $recruit['city']}{$recruit['city']}{else}未填写{/if}</span></p>
	<p class="mess">擅长项目<span class="my-data">{if $recruit['pro']}{$recruit['pro']}{else}未填写{/if}</span></p>
	<p class="mess">相机型号<span class="my-data">{if $recruit['camera']}{$recruit['camera']}{else}未填写{/if}</span></p>
	<p class="mess">镜片型号<span class="my-data">{if $recruit['lens']}{$recruit['lens']}{else}未填写{/if}</span></p>
	<p class="mess">拍摄经历:</p>
		<span style="float: right;color: #8f8f94;margin: 0;padding: 5px 10%;font-size: 14px; border-bottom: 1px solid #eeeeee;">{if $recruit['experience']}{$recruit['experience']}{else}未填写{/if}</span>
	<p class="mess mui-content-padded">身份证正反面<br><br>
		<img data-preview-src="" data-preview-group="1" src="{if $recruit['positive']}{$recruit['positive']}{else}{$aideUrl}app/resource/aitimt/images/positive.png{/if}" width="100">
		<img data-preview-src="" data-preview-group="1" src="{if $recruit['reverse']}{$recruit['reverse']}{else}{$aideUrl}app/resource/aitimt/images/reverse.png{/if}" width="100">
	</p>
	<p class="mess mui-content-padded">上传样片<br><br>
		{loop $recruit['picnum'] $pic}
		<img data-preview-src="" data-preview-group="2" src="{php echo tomedia($pic)}" width="100" height="100">
		{/loop}
	</p>
	<div class="bottomBtn">
		<button type="button" class="buttomEdit"  onclick="edit()">
			编辑
		</button>
	</div>
</div>

<script type="text/javascript" src="{$aideUrl}app/resource/aitimt/js/mui.zoom.js?v=20170912"></script>
<script type="text/javascript" src="{$aideUrl}app/resource/aitimt/js/mui.previewimage.js?v=20170912"></script>
<script>
    mui.previewImage(
    );
    function initStatus(imgSrc) {}
    function photoClose() {}
	function edit() {
        location.href = "{php echo app_url('home/index/recruit')}&edit=1";
    }
</script>
{else}
<div class="mui-content">

	<div style="font-size: 17px;color: #e94709;margin-left: 5%;padding: 2% 0;font-weight: 500;" >
		注册摄影师
		<div class="circle"></div>
		<div class="circle">.......</div>
		<div class="circle circle-active">.......</div>
	</div>
	<div class="entry-message">
		<form  action="" method="post" id="formdata" enctype="multipart/form-data">
			<input type="hidden" id="fid" name="fid" value="{$recruit['id']}" />
			<div id="recruit1" style="display:block;">
				<p>姓名*:</p>
				<input type="text" name="name" placeholder="请输入姓名" id="name" value="{$recruit['name']}" />
				<p>昵称*:</p>
				<input type="text" name="nickname" placeholder="请输入昵称" id="nickname" value="{$recruit['nickname']}" />
				<p>手机号码*:</p>
				<input type="text" name="phone" placeholder="请输入手机号码" id="mobile" value="{$recruit['mobile']}" style="width:70%;"/>
				<button type="button" onclick="sendSms()" id="getCode" style="width: 28%;font-size: 14px;padding: 8px 0">获取验证码</button>
				<p>验证码*:</p>
				<input type="text" name="code" placeholder="请输入验证码" id="code" value="" />
				<nav class="mui-bar mui-bar-tab">
					<a class="mui-tab-item mui-active" onclick="nextRecruit(2)" style="background: #e94709;color: #FFFFFF;">
						<span class="mui-tab-label">下一步</span>
					</a>
				</nav>
			</div>
			<div id="recruit2" style="display:none;">
				<p>身份证(拍照上传正反两面)*:</p>
				<div class="id-card">
					<div class="positive">
						<input  type="file" name="positive" id="positive" onchange="Upload(1);" accept="image/*"/>
						<img id="positive-img" src="{if $recruit['positive']}{$recruit['positive']}{else}{$aideUrl}app/resource/aitimt/images/positive.png{/if}" style="padding: 20px;" >
						<div id="positive-message" style="height: 25px;margin-top: 75px;"></div>

					</div>
					<div class="reverse">
						<input  type="file" name="reverse" id="reverse" onchange="Upload(2);" accept="image/*"/>
						<img id="reverse-img" src="{if $recruit['reverse']}{$recruit['reverse']}{else}{$aideUrl}app/resource/aitimt/images/reverse.png{/if}" style="padding: 20px;" >

						<div id="reverse-message"></div>

					</div>

				</div>

				<p style="margin-top: 35%;">邮箱*:</p>
				<input type="text" name="email" placeholder="请输入邮箱" id="email" value="{$recruit['email']}" />
				<p>常住城市*:</p>
				<input type="text" name="city" placeholder="请填写城市(如广州市)" id="city" value="{$recruit['city']}"/>
				<p>擅长拍摄项目*:</p>
				<input type="text" name="pro" placeholder="如路跑/越野/骑行等" id="pro" value="{$recruit['pro']}" />

				<nav class="mui-bar mui-bar-tab">
					<a class="mui-tab-item" onclick="nextRecruit(1)" style="color: #000;" data-value=1 >
						<span class="mui-tab-label" >上一步</span></a>
					<a class="mui-tab-item mui-active " onclick="nextRecruit(3)" style="background: #e94709;color: #FFFFFF;">
						<span class="mui-tab-label" >下一步</span></a>
				</nav>
			</div>
			<div id="recruit3" style="display:none;">
				<p>相机(机身)型号*:</p>
				<input type="text" name="camera" placeholder="多台设备请用逗号隔开" id="camera" value="{$recruit['camera']}" />

				<p>镜头型号*:</p>
				<input type="text" name="lens" placeholder="多台设备请用逗号隔开" id="lens" value="{$recruit['lens']}" />
				<p>拍摄经历*:</p>
				<textarea type="text" name="experience" style="border-radius: 8px;" placeholder="请输入拍摄经历" id="experience">{$recruit['experience']}</textarea>
				<div style="margin-top: 16px;margin-bottom: 10px;color:#8f8f94 ;">
					<span class="title">样片上传(可上传多张)*</span>
					<span id="picnum" style="float: right;margin-right: 20px;font-size: 12px; color: #8f8f94;">0/5</span>
				</div>
				<div class="preview" style="background-color: #ffffff;height: 70px;width: 100%;">
					<ul class="row mui-input-row" id="preview" style="border-radius: 8px">
						<li>
							<img onclick="setImagePreviews()" src="{$aideUrl}app/resource/aitimt/images/addd.png"/>
						</li>
					</ul>
				</div>
				<nav class="mui-bar mui-bar-tab">
					<a class="mui-tab-item" onclick="nextRecruit(2)" style="color: #000;">
						<span class="mui-tab-label"  >上一步</span></a>
					<a class="mui-tab-item mui-active" onclick="check(3)" style="background: #e94709;color: #FFFFFF;">
						<span class="mui-tab-label" >提交</span></a>
				</nav>
			</div>
		</form>
	</div>
</div>
{/if}
{else}
<div class="mui-content">

	<div style="font-size: 17px;color: #e94709;margin-left: 5%;padding: 2% 0;font-weight: 500;" >
		注册摄影师
		<div class="circle"></div>
		<div class="circle">.......</div>
		<div class="circle circle-active">.......</div>
	</div>
	<div class="entry-message">
		<form  action="" method="post" id="formdata" enctype="multipart/form-data">
			<input type="hidden" id="fid" name="fid" value="{$recruit['id']}" />
			<div id="recruit1" style="display:block;">
				<p>姓名*:</p>
				<input type="text" name="name" placeholder="请输入姓名" id="name" value="{$recruit['name']}" />
				<p>昵称*:</p>
				<input type="text" name="nickname" placeholder="请输入昵称" id="nickname" value="{$recruit['nickname']}" />
				<p>手机号码*:</p>
				<input type="text" name="phone" placeholder="请输入手机号码" id="mobile" value="{$recruit['mobile']}" style="width:70%;"/>
				<button type="button" onclick="sendSms()" id="getCode" style="width: 28%;font-size: 14px;padding: 8px 0">获取验证码</button>
				<p>验证码*:</p>
				<input type="text" name="code" placeholder="请输入验证码" id="code" value="" />
				<nav class="mui-bar mui-bar-tab">
					<a class="mui-tab-item mui-active" onclick="nextRecruit(2)" style="background: #e94709;color: #FFFFFF;">
						<span class="mui-tab-label">下一步</span>
					</a>
				</nav>
			</div>
			<div id="recruit2" style="display:none;">
				<p>身份证(拍照上传正反两面)*:</p>
				<div class="id-card">
					<div class="positive">
						<input  type="file" name="positive" id="positive" onchange="Upload(1);" accept="image/*"/>
                        <img id="positive-img" src="{if $recruit['positive']}{$recruit['positive']}{else}{$aideUrl}app/resource/aitimt/images/positive.png{/if}" style="padding: 20px;" >
                        <div id="positive-message" style="height: 25px;margin-top: 75px;"></div>

					</div>
					<div class="reverse">
						<input  type="file" name="reverse" id="reverse" onchange="Upload(2);" accept="image/*"/>
                        <img id="reverse-img" src="{if $recruit['reverse']}{$recruit['reverse']}{else}{$aideUrl}app/resource/aitimt/images/reverse.png{/if}" style="padding: 20px;" >

                        <div id="reverse-message"></div>

					</div>

				</div>

				<p style="margin-top: 35%;">邮箱*:</p>
				<input type="text" name="email" placeholder="请输入邮箱" id="email" value="{$recruit['email']}" />
				<p>常住城市*:</p>
				<input type="text" name="city" placeholder="请填写城市(如广州市)" id="city" value="{$recruit['city']}"/>
				<p>擅长拍摄项目*:</p>
				<input type="text" name="pro" placeholder="如路跑/越野/骑行等" id="pro" value="{$recruit['pro']}" />

				<nav class="mui-bar mui-bar-tab">
					<a class="mui-tab-item" onclick="nextRecruit(1)" style="color: #000;" data-value=1 >
						<span class="mui-tab-label" >上一步</span></a>
					<a class="mui-tab-item mui-active " onclick="nextRecruit(3)" style="background: #e94709;color: #FFFFFF;">
						<span class="mui-tab-label" >下一步</span></a>
				</nav>
			</div>
			<div id="recruit3" style="display:none;">
				<p>相机(机身)型号*:</p>
				<input type="text" name="camera" placeholder="多台设备请用逗号隔开" id="camera" value="{$recruit['camera']}" />

				<p>镜头型号*:</p>
				<input type="text" name="lens" placeholder="多台设备请用逗号隔开" id="lens" value="{$recruit['lens']}" />
				<p>拍摄经历*:</p>
				<textarea type="text" name="experience" style="border-radius: 8px;" placeholder="请输入拍摄经历" id="experience">{$recruit['experience']}</textarea>
				<div style="margin-top: 16px;margin-bottom: 10px;color:#8f8f94 ;">
					<span class="title">样片上传(可上传多张)*</span>
					<span id="picnum" style="float: right;margin-right: 20px;font-size: 12px; color: #8f8f94;">0/5</span>
				</div>
				<div class="preview" style="background-color: #ffffff;height: 70px;width: 100%;">
					<ul class="row mui-input-row" id="preview" style="border-radius: 8px">
						<li>
							<img onclick="setImagePreviews()" src="{$aideUrl}app/resource/aitimt/images/addd.png"/>
						</li>
					</ul>
				</div>
				<nav class="mui-bar mui-bar-tab">
					<a class="mui-tab-item" onclick="nextRecruit(2)" style="color: #000;">
						<span class="mui-tab-label"  >上一步</span></a>
					<a class="mui-tab-item mui-active" onclick="check(3)" style="background: #e94709;color: #FFFFFF;">
						<span class="mui-tab-label" >提交</span></a>
				</nav>
			</div>
		</form>
	</div>
</div>
{/if}
<script type="text/javascript">

    $(document).ready(function(){
    });
    $("input textarea").focus(function(){
        $('.mui-bar-tab').css('display','none');
    });

    $("input textarea").blur(function(){
        $('.mui-bar-tab').css('display','table');
    });
    function nextRecruit(value){
        if (value==1){
            document.getElementById('recruit1').style='display:block';
            document.getElementById('recruit2').style='display:none';
            $(".circle").each(function(i){
                if (i==1){
                    $(this).removeClass('circle-active');
                }
            });
        }else if(value==2){
            if(check(1)){
                document.getElementById('recruit1').style='display:none';
                document.getElementById('recruit2').style='display:block';
                document.getElementById('recruit3').style='display:none';
                $(".circle").each(function(i){
                    if (i<1){$(this).removeClass('circle-active');
                    }else{
                        $(this).addClass('circle-active');
                    }
                });
            }

        }else if(value==3){
            if (check(2)){
                document.getElementById('recruit2').style='display:none';
                document.getElementById('recruit3').style='display:block';
                $(".circle").each(function(i){
                    $(this).addClass('circle-active');
                });
            }

        }
    }
    function Upload(id) {
        var fid = $("#fid").val();
        if (id==1) {
            var $pic = document.querySelector("#positive");//上传出发按钮
            var $img = document.querySelector("#positive-img");
            var $type='positive';
            var message= document.getElementById('positive-message');
        }else {
            var $pic = document.querySelector("#reverse");//上传出发按钮
            var $img = document.querySelector("#reverse-img");
            var $type='reverse';
            var message= document.getElementById('reverse-message');
        }
        var html='';
        $.ajaxFileUpload({
            type: "POST",
            url: "{php echo app_url('home/index/imagesajax')}",
            data:{fid:fid,type:$type,source:'recruit'},
            fileElementId:$type,//文件选择框的id属性
            secureuri : false,//是否启用安全提交，默认为false
            dataType: 'json',//服务器返回的格式
            async : false,
            success: function(res){
                if(res.errno==0){
                    $("#fid").attr("value", res.data.fid);
                    message.innerHTML='';
                    var file = $pic.files[0];//获取file对象单张
                    var reader = new FileReader();//创建filereader对象
                    reader.readAsDataURL(file);//转换数据
                    reader.onload = function (e) {//加载ok时触发的事件
                        $img.removeAttribute("src");
                        $img.setAttribute("src", e.target.result);
                    };
                }else{
                    html = "<p style='color:#d06f6f'>" + res.errmsg + "</p>";

                    message.innerHTML=html;
                    $img.setAttribute("src", '');

                }
            },
            error: function (data, status, e){
                console.log(2)
            }
        });
    };
    function check(value) {
        var name=$.trim($("#name").val());
        var nickname=$.trim($("#nickname").val());
        var mobile=$.trim($("#mobile").val());
        var mobile_pattern = /(?:\(?[0\+]?\d{1,3}\)?)[\s-]?(?:0|\d{1,4})[\s-]?(?:(?:13\d{9})|(?:\d{7,8}))/;
        var code=$.trim($("#code").val());
        var email=$.trim($("#email").val());
        var city=$.trim($("#city").val());
        var pro=$.trim($("#pro").val());
        var fid=$.trim($("#fid").val());
        var camera=$.trim($("#camera").val());
        var lens=$.trim($("#lens").val());
        var experience=$.trim($("#experience").val());
        if (value>0){
            if (name == '') {
                mui.toast('请输入姓名');
                $('#mobile').focus();
                return false;
            }
            if (nickname == '') {
                mui.toast('请输入昵称');
                $('#mobile').focus();
                return false;
            }
            if (mobile == '') {
                mui.toast('请输入手机号');
                $('#mobile').focus();
                return false;
            }
            if (!mobile_pattern.test(mobile)) {
                mui.toast('请输入正确的手机号');
                $('#mobile').focus();
                return false;
            }
            if (code == '') {
                mui.toast('请输入验证码');
                $('#mobile').focus();
                return false;
            }
            if (code !=localStorage.getItem('code')) {
                mui.toast('请输入正确的验证码');
                $('#mobile').focus();
                return false;
            }
            if (value==1){
                return true;
            }
            if (fid == '') {
                mui.toast('请上传身份证照');
                return false;
            }
            if (email == '') {
                mui.toast('请输入邮箱');
                $('#email').focus();
                return false;
            }
            if (city == '') {
                mui.toast('请输入所在城市');
                $('#city').focus();
                return false;
            }
            if (pro == '') {
                mui.toast('请输入擅长拍摄项目');
                $('#pro').focus();
                return false;
            }
            if (value==2){
                return true;
            }
            if (camera == '') {
                mui.toast('请输入相机型号');
                $('#camera').focus();
                return false;
            }
            if ( lens== '') {
                mui.toast('请输入镜头型号');
                $('#lens').focus();
                return false;
            }
            if (experience == '') {
                mui.toast('请输入拍摄经历');
                $('#experience').focus();
                return false;
            }
            if (arruploadfile == '') {
                mui.toast('请上传样片');
                return false;
            }
            for (var i=0;i<imgA.length;i++){
                struploadfile+=imgA[i]+',';
            }
            var arr={name:name,nickname:nickname,mobile:mobile,email:email,city:city,pro:pro,camera:camera,lens:lens,experience:experience,picnum:struploadfile}
//738313
            $.post("{php echo app_url('home/index/recruit')}", arr, function(data){
                console.log(data);
                if(data.errno == 0){
                    mui.toast(data.msg);
                    location.href ="javascript:history.go(-1)";
                }else{
                    mui.toast('服务器错误!');
                }
            },"json");
        }
    }
    function  sendSms() {
        var mobile = $.trim($("#mobile").val());
        var mobile_pattern = /(?:\(?[0\+]?\d{1,3}\)?)[\s-]?(?:0|\d{1,4})[\s-]?(?:(?:13\d{9})|(?:\d{7,8}))/;
        if (mobile == '') {
            mui.toast('请输入手机号');
            $('#mobile').focus();
            return false;
        }
        if (!mobile_pattern.test(mobile)) {
            mui.toast('请输入正确的手机号');
            $('#mobile').focus();
            return false;
        }
        $.post("{php echo app_url('home/index/login1')}", {type:'sms',mobile:mobile}, function(data){
            console.log(data);
            if(data.errno == 0){
                mui.toast(data.msg);
                time();
                localStorage.setItem('code',data.code);
            }else{
                time();

                mui.toast('服务器错误！');
                localStorage.setItem('code',data.code);

            }
        },"json");
    }
    var wait=60;
    function time(){
        var o=document.getElementById('getCode');
        if (wait==0) {
            o.removeAttribute("disabled");
            o.innerHTML="获取验证码";
            o.style.backgroundColor="#fff";
            wait=60;
        }else{
            o.setAttribute("disabled", true);
            o.innerHTML=wait+"(s)";
            o.style.backgroundColor="#8f8b8b";
            wait--;
            setTimeout(function(){
                time(o)
            },1000)
        }
    }
    var arruploadfile = [];
    var struploadfile = '';
    var imgA=new Array();
    var imgserverId;
    function setImagePreviews() {
        arruploadfile=[];
        var result='';
        wx.chooseImage({
            count: 5, // 默认9
            sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
            success: function (res) {
                imgA=[];
                imgserverId="";
                var localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片

                document.getElementById("picnum").innerText=localIds.length+'/5';
                for(var i=0;i<localIds.length;i++){
                    result+='<li onclick="delImg(this)"><img src="' +localIds[i] + '" /><span class="del"></span></li>';
                    arruploadfile.push(localIds[i]);
                }
                syncUpload(localIds)
                result+='<li><img onclick="setImagePreviews()" src="{$aideUrl}app/resource/aitimt/images/addd.png"/></li>'
                document.getElementById('preview').innerHTML=result;
            }

        });

    }
    var syncUpload = function(localIds){
        var localId = localIds.pop();
        wx.uploadImage({
            localId: localId.toString(), // 需要上传的图片的本地ID，由chooseImage接口获得
            isShowProgressTips: 1, // 默认为1，显示进度提示
            success: function (res) {
                //res.serverId 返回图片的服务器端ID
                var serverId = res.serverId; // 返回图片的服务器端ID
                imgA.push(serverId)
                imgserverId=imgA;
                if(localIds.length > 0){
                    window.setTimeout(function(){
                        syncUpload(localIds);
                    },100);
                }else{
                    window.setTimeout(function(){
                        downloadImage(0);
                    },100);

                }
            }
        })
    }
    function delImg(obj){
        var list =document.getElementsByTagName('li');
        for(var i=0;i<list.length;i++){
            list[i].index=i;
        }
        var idx=2-obj.index;
        var ul=obj.parentNode;
        var btnArray=['是','否'];
        mui.confirm("确定要删除此图?",function(e){
            if(e.index==1){
                ul.removeChild(obj);
                arruploadfile.splice(idx,1);
                document.getElementById("picnum").innerText=Number(arruploadfile.length)+'/5';
            }
        },{"buttons":btnArray})

    }
</script>

</body>

</html>
